<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        div{
            border: 1px solid #ccc;
        }
        .d1{
            width: 300px;
            height: 300px;
        }
        .d2{
            width: 200px;
            height: 200px;
        }
        .d3{
            width: 100px;
            height: 100px;
        }
    </style>
    <script>
        function f1(){
            console.log(111);
        }

        function f2(){
            console.log(222);
        }

        function f3(event){
            console.log(333);
            event.stopPropagation(); // 阻止事件冒泡
        }

        window.onload = function(){
            document.getElementById('hello').onclick = function (event) {
                console.log(111);

                event.preventDefault(); // 阻止默认行为

            }
        }
    </script>

</head>
<body>
    <div class="d1" onclick="f1()">div1
        <div class="d2"  onclick="f2()">div2
            <div class="d3"  onclick="f3(event)">div3</div>
        </div>
    </div>
    <hr>

    <a href="http://www.baidu.com" id="hello">点我</a>
</body>
</html>